using System.Collections.Generic;
using System.Linq;
using UserStoryTrackerDemo.Domain.Pocos;
using UserStoryTrackerDemo.Models;

namespace UserStoryTrackerDemo.Helpers
{
	public static class Extensions
	{
		public static List<UserStoryVM> ConvetUserStoriesToVMs(this List<UserStory> userStories)
		{
			return (from userStory in userStories
			        select new UserStoryVM()
			               	{
			               		AsA = userStory.AsA,
			               		Completed = userStory.Completed,
			               		ICan = userStory.ICan,
			               		SoThatBecause = userStory.SoThatBecause,
								Id = userStory.Id
			               	}).ToList();

		}

		public static UserStoryVM ConvertUserStoryToVM(this UserStory userStory)
		{
			return new UserStoryVM()
			       	{
			       		AsA = userStory.AsA,
						Completed = userStory.Completed,
						ICan = userStory.ICan,
						Id = userStory.Id,
						SoThatBecause = userStory.SoThatBecause,
			       	};
		}
	}
}